package com.bdq.content.infrastructure.persistence.mysql.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdq.common.enums.YesOrNoEnum;
import com.bdq.content.infrastructure.persistence.mysql.pojo.ContentLocation;
import com.bdq.content.infrastructure.persistence.mysql.service.ContentLocationService;
import com.bdq.content.infrastructure.persistence.mysql.mapper.ContentLocationMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author malei
* @description 针对表【content_location(内容所在地表)】的数据库操作Service实现
* @createDate 2024-05-10 17:16:39
*/
@Service
public class ContentLocationServiceImpl extends ServiceImpl<ContentLocationMapper, ContentLocation>
    implements ContentLocationService {

    @Override
    public ContentLocation getByContentId(Long contentId) {
        return lambdaQuery()
                .eq(ContentLocation::getContentId, contentId)
                .eq(ContentLocation::getIsDeleted, YesOrNoEnum.NO.getCode())
                .one();
    }

    @Override
    public List<ContentLocation> listByContentIds(List<Long> contentIds) {
        return lambdaQuery()
                .in(ContentLocation::getContentId, contentIds)
                .eq(ContentLocation::getIsDeleted, YesOrNoEnum.NO.getCode())
                .list();
    }
}




